<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 需求1
        let arr=[]
        let age=0
        for(let i=0;i<5;i++){
            
        let shuru= +prompt('请输入年龄0-100')
        if(shuru>0 && shuru<100){
           arr.push(shuru)
        }
        }
        console.log(arr);
        // 需求2
        for(let j=0;j<arr.length;j++){
            if(arr[j]>=18){
                console.log(arr[j]);
            }
            // console.log(age+=arr[j]);
        }
        // 需求3
        for(let j=0;j<arr.length;j++){ 
                age+=arr[j]
        }
        console.log(age);
        // 需求4
        let pingjun=age/arr.length
        console.log(pingjun);
        // 需求5
        let num=arr[0]
        let num1=arr[0]
        for(let i=0;i<5;i++){ 
            // 最大年龄 
            if(arr[0]<arr[i]) num=arr[i]
                // 最小年龄
            if(arr[0]>arr[i]) num1=arr[i]
        }
        console.log(num)
        console.log(num1);
        
    </script>
</body>
</html>